package springboot.study.project.service;

import springboot.study.project.model.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * @InterfaceName: UserService
 * @Description: 用户服务接口
 * @Author: liu-hao
 * @Date: 2021-03-04 23:00
 * @Version: 1.0
 **/
public interface UserService {

    /**
     * @Author: liu-hao
     * @Description: 登录校验
     * @Date: 2021/3/12 23:04
     * @Param: userName 用户姓名
     * @Param: userPwd 用户密码
     * @return: int 登录状态
     **/
    int login(String userName, String userPwd,String role, String isRememberPwd, HttpServletRequest request, HttpServletResponse response);

    /**
     * @Author: liu-hao
     * @Description: 退出登录
     * @Date: 2021/3/12 23:03
     * @Param: userId  用户ID
     * @return: void
     **/
    void logout(String userId, HttpServletRequest request, HttpServletResponse response);

    /**
     * @Author: liu-hao
     * @Description: 添加用户
     * @Date: 2021/3/12 23:02
     * @Param: user
     * @return: boolean
     **/
    boolean addUser(User user);

    /**
     * @Author: liu-hao
     * @Description: 修改用户信息
     * @Date: 2021/3/12 23:00
     * @Param: user
     * @return: boolean
     **/
    boolean modifyUserInfo(User user);

    /**
     * 删除用户
     *
     * @param userId 用户ID
     * @return 删除成功返回true, 失败返回false
     */
    boolean removeUser(String userId);


    /**
     * @Author: liu-hao
     * @Description: 禁用用户
     * @Date: 2021/3/12 23:00
     * @Param: userid
     * @return: boolean
     **/
    boolean banUser(String userId);

    /**
     * 根据token获取用户信息
     *
     * @param token
     * @return
     */
    User findUserByToken(String token);

    /**
     * 根据用户ID获取用户信息
     *
     * @param userId
     * @return
     */
    User findUserById(String userId);


    /**
     * 获取分页信息
     * @param userName
     * @param role
     * @param offset
     * @param pageSize
     * @return
     */
    Map<String, Object> findUser(String userName, String realName, String role, int offset, int pageSize);
}
